import 'paging_model.dart';
import 'result_model.dart';
import 'semester_model.dart';

///学校学期-查询-请求
class SchoolSemesterQueryReq extends PagingQueryReq {
  final String schoolId;
  final int status;

  SchoolSemesterQueryReq({
    required this.schoolId,
    required this.status,
    super.index,
    super.size,
  });

  @override
  Map<String, dynamic> toMap() {
    final map = super.toMap();
    map['status'] = status;
    return map;
  }
}

///学校学期-查询-响应
class SchoolSemesterQueryRes extends PagingQueryRes<SemesterItemRes> {
  SchoolSemesterQueryRes({
    required super.retCode,
    required super.retMessage,
    super.total,
    super.rows,
  });

  factory SchoolSemesterQueryRes.fromModel(final ResultModelRes res) {
    final ret = PagingQueryRes.fromModel(
      res,
      (row) => SemesterItemRes.fromMap(row),
    );
    return SchoolSemesterQueryRes(
      retCode: ret.retCode,
      retMessage: ret.retMessage,
      total: ret.total,
      rows: ret.rows,
    );
  }
}

///学校学期-保存-请求
class SchoolSemesterSaveReq {
  final String schoolId;
  final List<String> semesters;
  final bool isAppend;

  const SchoolSemesterSaveReq({
    required this.schoolId,
    required this.semesters,
    required this.isAppend,
  });

  Map<String, dynamic> toMap() => {
        'semesters': semesters,
        'isAppend': isAppend,
      };
}

///学校学期-删除-请求
class SchoolSemesterDeleteReq {
  final String schoolId;
  final String semesterId;

  const SchoolSemesterDeleteReq({
    required this.schoolId,
    required this.semesterId,
  });
}
